package com.cyloer.strategy.common;

import com.cyloer.strategy.Impl.DisCountFiveServiceImpl;
import com.cyloer.strategy.Impl.DisCountTenServiceImpl;
import com.cyloer.strategy.service.DisCountService;
import org.springframework.util.StringUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * @Description:
 * @author: xiangliu5
 * @date: 2022/12/26 20:01
 */

public class DisCountPay {

    private static List<DisCountService> arrayList = new ArrayList<>();

    static {
        arrayList.add(new DisCountFiveServiceImpl());
        arrayList.add(new DisCountTenServiceImpl());
    }

    public DisCountPay(String type) {
        if (StringUtils.isEmpty(type)) {
            return;
        }
        for (DisCountService discount : arrayList) {
            if (!discount.support(type)) {
                continue;
            }
            discount.disCountPay();
        }


    }
}
